#include "stl.h"
#include "linkedlist.h"
#include "solution.h"
int main(int argc, char *argv[])
{
    vector<vector<int>> testcases[] = {// A链表,B链表,相交部分
        { {4,1}, {5,0,1}, {8, 4,5} },
        { {3,4}, {1,2,8}, {} },
    };

    Solution sln;
    for(auto & t : testcases){
        vector<ListNode> vec[3];
        vector<ListNode*> list;
        for(size_t i=0; i<t.size(); i++)
            list.push_back( LinkedList::Link(t[i], &vec[i]) );
        // print("list=", list, "\n")
        vec[0].rbegin()->next = vec[1].rbegin()->next = list[2];
        print("headA=", list[0], "\n")
        print("headB=", list[1], "\n")
        ListNode * ans = NULL;
        ans = sln.getIntersectionNode(list[0], list[1]);
        print("ans:", ans, "\n\n")
    }
    return 0;
}